/**
 *
 * @author Osvaldo Rosado
 */
public class Embed {
    public boolean Embed(int AppHwnd,int AppletHwnd){
        WinApi WinApi;
        WinApi = new WinApi();
        if(Main.GMCHECK==false){
            if(WinApi.User32.SetParent(AppHwnd,AppletHwnd)!=0){
                System.err.println("Application successfully Re-Parented");
            }else{
                return false;
            }
            if(WinApi.User32.SetWindowLongA(AppHwnd,-16,268435456)!=0){
                System.err.println("Application border successfully removed");
            }else{
                return false;
            }
            if(WinApi.User32.MoveWindow(AppHwnd,0,0,Main.panel1.WIDTH,Main.panel1.HEIGHT,false)!=0){
               System.err.println("Application successfully resized and relocated");
               return true;
            }else{
                return false;
            }
        }else{
            System.err.println("GM Special Detection Mode used. Re-parenting, border removing, and resizing assumed to be successful.");
            return true;
        }
    }
}
